package com.zhou.Controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.zhou.pojo.User;
import com.zhou.service.IUserService;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/user")
@ResponseBody
public class UserController {

    @Reference
    private IUserService iUserService;

    @RequestMapping("/findAll")
    public List<User> findAll() {

        return iUserService.findAll();
    }

    @RequestMapping("/findById")
    public User findById(int id) {
        return iUserService.findById(id);
    }

    @RequestMapping("/update")
    public void update(@RequestBody User user) {
        iUserService.update(user);
    }
}
